package com.polaris.live.ui.live.proxy.caller

import android.content.Context
import android.view.Gravity
import android.widget.ImageView
import android.widget.LinearLayout
import android.widget.TextView
import com.blankj.utilcode.util.ColorUtils
import com.polaris.live.R
import com.polaris.live.common.ext.autoDp

/**
 * BaseVideoListenerProxy
 *
 * @author Created by 天晴 on 2024/4/27 10:47
 * @since 1.0.0
 **/
open class BaseVideoListenerProxy {
    fun creatorLinearLayout(context: Context): LinearLayout {
        return LinearLayout(context).apply {
            val linearLayoutParams = LinearLayout.LayoutParams(
                LinearLayout.LayoutParams.WRAP_CONTENT,
                LinearLayout.LayoutParams.WRAP_CONTENT
            )
            linearLayoutParams.topMargin = 2.autoDp
            layoutParams = linearLayoutParams
            gravity = Gravity.CENTER_VERTICAL
            setBackgroundResource(R.drawable.r11_back_000000_30)
            val image = ImageView(context)
            image.id = R.id.videolistenerproxy_img
            val imageLayoutParams = LinearLayout.LayoutParams(10.autoDp, 10.autoDp)
            imageLayoutParams.marginStart = 6.autoDp
            image.layoutParams = imageLayoutParams
            val textView = TextView(context)
            textView.id = R.id.videolistenerproxy_tv
            val textLayoutParams = LinearLayout.LayoutParams(
                LinearLayout.LayoutParams.WRAP_CONTENT,
                LinearLayout.LayoutParams.WRAP_CONTENT
            )
            textLayoutParams.marginStart = 3.autoDp
            textLayoutParams.marginEnd = 6.autoDp
            textView.textSize = 10F
            textView.setTextColor(ColorUtils.getColor(R.color.white))
            textView.layoutParams = textLayoutParams
            addView(image)
            addView(textView)
        }
    }
}